package com.beiding.fastmock.fram;

import org.springframework.stereotype.Component;

import javax.servlet.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 丁常磊
 * @date 2021/7/22 18:39
 */

@Component
public class FramFilter implements Filter {

    private List<Filter> filters=new ArrayList<>();

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        VirtualFilterChain virtualFilterChain = new VirtualFilterChain(filterChain, filters);
        virtualFilterChain.doFilter(servletRequest, servletResponse);
    }

    public List<Filter> getFilters() {
        return filters;
    }
}
